import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: '0.0.0.0',//解决控制台
    port: 8080,//配置端口号
    hmr: true,//热更新
    open: true,//自动打开浏览器
    proxy:{
      '/api':{
        target:'http://8.130.31.180:8082',
        changeOrigin:true,
        rewrite:(path) => path.replace(/^\/api/,'')
      }
    }
  },
  resolve: {
    alias: [
      {
        find: '@',
        replacement: resolve(__dirname, 'src')
      }
    ]
  },
  define:{
    'process.env':{
      'BASE_API': "http://8.130.31.180:8082"
    }
  }
})
